package com.hzcx.app.simplechat.ui.setting.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.ui.setting.bean.ReportBean;

import java.util.List;

public class ReportAdapter extends BaseQuickAdapter<ReportBean, BaseViewHolder> {

    private int pos = -1;

    public ReportAdapter(@Nullable List<ReportBean> data) {
        super(R.layout.rv_item_report, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ReportBean item) {
        helper.setText(R.id.tv_report_name, item.getName());

        if (pos == helper.getAdapterPosition()) {
            helper.setImageResource(R.id.iv_check_box, R.mipmap.ic_icon_check_select);
        } else {
            helper.setImageResource(R.id.iv_check_box, R.mipmap.ic_icon_check_normal);
        }

    }

    public void setPos(int pos) {
        this.pos = pos;
        notifyDataSetChanged();
    }

    public int getPos(){
        return pos;
    }
}
